<?php
//消费券相关

namespace App\Http\Controllers\Manage;

use App\Http\Controllers\BaseController;
use App\Services\Manage\CouponManageService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class CouponController extends BaseController
{

    /**
     * 获取券批次展示信息
     * @param  Request  $request
     * @return JsonResponse
     */
    public function getStockShowInfo(Request $request) {
        $stockId = $request->get('stock_id');

        $res = CouponManageService::getStockShowInfo($stockId);

        return $this->success($res);
    }

    /**
     * 优惠券发放任务列表
     * @param  Request  $request
     * @return JsonResponse
     */
    public function sendTaskList(Request $request) {
        $query = $request->all();
        $page = $request->get('page', 1);
        $pageSize = $request->get('page_size', 20);

        $res = CouponManageService::sendTaskList($query, $page, $pageSize);

        return $this->success($res);
    }

    /**
     * 优惠券发放任务详情
     * @param  Request  $request
     * @return JsonResponse
     */
    public function sendTaskInfo(Request $request) {
        $taskId = $request->get('task_id');

        $res = CouponManageService::sendTaskInfo($taskId);

        return $this->success($res);
    }



}
